/**
 * 
 */
package de.nak.fireDepartment.dao;

import java.util.Collection;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import de.nak.fireDepartment.model.Equipment;

/**
 * Equipment data access object.
 * @author Nils Bredow
 */
public class EquipmentDAO extends HibernateDaoSupport {
	
	/**
	 * Finds and returns all Equipment.
	 * @return a list of Equipment.
	 */
	@SuppressWarnings("unchecked")
	public Collection<Equipment> findAll() {
		return (Collection<Equipment>)getHibernateTemplate().find("from Equipment");
	}
	
	/**
	 * Finds a Equipment with the given id.
	 * @param equipmentId The id.
	 * @return a Equipment object or <code>null</code>.
	 */
	public Equipment findById(Long equipmentId) {
		return (Equipment)getHibernateTemplate().get(Equipment.class, equipmentId);
	}
	
	/**
	 * Persists the given Equipment object.
	 * @param Equipment The Equipment.
	 */
	public void save(Equipment equipment) {
		getHibernateTemplate().save(equipment);
	}
	
	/**
	 * Deletes the given Equipment object.
	 * @param Equipment The Equipment.
	 */
	public void delete(Equipment equipment) {
		getHibernateTemplate().delete(equipment);
	}
}
